//
//  WBControllerManager.m
//  WeatherBar
//
//  Created by yby on 2024/6/7.
//

#import "WBControllerManager.h"
#import "WBTabbarController.h"
#import "WBNavigationController.h"
#import "WBHomeVC.h"

@implementation WBControllerManager


+(WBControllerManager *)wb_shareTabbarVC {
    static WBControllerManager * var_TabbarVC = nil;
    static dispatch_once_t var_onceToken;
    dispatch_once(&var_onceToken, ^{
        var_TabbarVC = [[WBControllerManager alloc]init];
        [self wb_doObserverLoginTokenExpire];
    });
    return var_TabbarVC;
}

+(void)wb_doObserverLoginTokenExpire {
    
    // 登录状态变化，主要用于控制页面跳转
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wb_loginStatusChange) name:kLoginStatusChangeNotification object:nil];
    // 退出登录
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidLogout) name:NotificationLogoutSuccess object:nil];
}

+ (void)wb_configRootVC {
    WeakSelf(weakSelf);
    //https://ewdlgs.flypaypro.ng/simon/index.html?b=717&c=202&t=时间戳#/index
    //https://ewdlgs.flypaypro.ng/simon/index.html?pagetype=2&ch=1522409001&cid=6b1d865de19150336f02ca8afeb34f68&appver=nigeria_1.0.0&mainver=1.0.0&t=1716433500101&b=717&lan=en_US&c=132#/entry
    //https://ewdlgs.flypaypro.ng/simon/index.html?pagetype=2&ch=1522409001&cid=6b1d865de19150336f02ca8afeb34f68&appver=nigeria_1.0.0&mainver=1.0.0&t=%@&b=717&lan=en_US&c=132#/entry
    NSString *var_url = [NSString stringWithFormat:@"https://ewdlgs.flypaypro.ng/simon/index.html?pagetype=2&ch=1522409001&cid=6b1d865de19150336f02ca8afeb34f68&appver=nigeria_1.0.0&mainver=1.0.0&t=%@&b=717&lan=en_US&c=132#/entry",kGetCurentTime];
    WBHomeVC *webVc = [[WBHomeVC alloc] initWithTitle:@"" gotoUrl:var_url];


    WBNavigationController* var_nav = [[WBNavigationController alloc] initWithRootViewController:webVc];
    [[UIApplication sharedApplication].delegate.window setRootViewController:var_nav];
}


/**
 给控制器包装nav
 */
+ (UIViewController *)wb_navWithController:(UIViewController *)vc
{
    WBNavigationController *var_nav = [[WBNavigationController alloc] initWithRootViewController:vc];
    return var_nav;
}

@end
